package com.ziyia.fragmentbasepracitce;

import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;

import org.w3c.dom.Text;

import butterknife.BindView;
import butterknife.ButterKnife;

public class NewsContentFragment extends Fragment {

    @BindView(R.id.contentLayout)
    LinearLayout linearLayout;

    @BindView(R.id.newsTitle)
    TextView newsTitle;

    @BindView(R.id.newsContent)
    TextView newsContent;


    @Override
    public void onCreate(@Nullable @org.jetbrains.annotations.Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Nullable
    @org.jetbrains.annotations.Nullable
    @Override
    public View onCreateView(@NonNull @org.jetbrains.annotations.NotNull LayoutInflater inflater, @Nullable @org.jetbrains.annotations.Nullable ViewGroup container, @Nullable @org.jetbrains.annotations.Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.news_content_frag, container, false);
        ButterKnife.bind(this, view);
        return view;
    }

    public void refresh(String title, String content) {
        linearLayout.setVisibility(View.VISIBLE);
        newsTitle.setText(title);
        newsContent.setText(content);
    }
}
